|
1
|
|
|
// Base path --> assets/html |
|
2
|
|
|
const electron = require('electron'), |
|
3
|
|
|
path = require('path'); |
|
|
|
|
|
|
4
|
|
|
|
|
5
|
|
|
require('../js/renderer/sw.js'); |
|
6
|
|
|
require('../js/renderer/bw.js'); |
|
7
|
|
|
require('../js/renderer/bwa.js'); |
|
8
|
|
|
|
|
9
|
|
|
window.$ = window.jQuery = require('jquery'); |
|
10
|
|
|
|
|
11
|
|
|
const { |
|
12
|
|
|
appSettings |
|
13
|
|
|
} = require('../js/appsettings.js'); |
|
14
|
|
|
|
|
15
|
|
|
const { |
|
16
|
|
|
ipcRenderer, |
|
17
|
|
|
remote, |
|
18
|
|
|
dialog |
|
19
|
|
|
} = electron; |
|
20
|
|
|
|
|
21
|
|
|
$(document).ready(function() { // When document is ready |
|
22
|
|
|
ipcRenderer.send('app:debug', "Document is ready"); |
|
23
|
|
|
|
|
24
|
|
|
startup(); |
|
25
|
|
|
|
|
26
|
|
|
// Button/Toggle special menu items |
|
27
|
|
|
$('#navButtonExtendedmenu').click(function() { |
|
28
|
|
|
ipcRenderer.send('app:debug', "#navButtonExtendedmenu was clicked"); |
|
29
|
|
|
$('#navButtonExtendedmenu').toggleClass('is-active'); |
|
30
|
|
|
$('.is-specialmenu').toggleClass('is-hidden'); |
|
31
|
|
|
}); |
|
32
|
|
|
|
|
33
|
|
|
// Window minimize button |
|
34
|
|
|
$('#navButtonMinimize').click(function() { |
|
35
|
|
|
ipcRenderer.send('app:debug', "#navButtonMinimize was clicked"); |
|
36
|
|
|
remote.getCurrentWindow().minimize(); |
|
37
|
|
|
}); |
|
38
|
|
|
|
|
39
|
|
|
// Window exit button |
|
40
|
|
|
$('#navButtonExit').click(function() { |
|
41
|
|
|
ipcRenderer.send('app:debug', "#navButtonExit was clicked"); |
|
42
|
|
|
remote.getCurrentWindow().close(); |
|
43
|
|
|
}); |
|
44
|
|
|
|
|
45
|
|
|
// Assign [ESC] to close message/modal |
|
46
|
|
|
$(document).keyup(function(event) { |
|
47
|
|
|
if (event.keyCode === 27) { |
|
48
|
|
|
ipcRenderer.send('app:debug', "Used [ESC] key, {0}".format(event.keyCode)); |
|
49
|
|
|
if ($('#swMessageWhois').hasClass('is-active')) { |
|
50
|
|
|
$('#swMessageWhoisClose').click(); |
|
51
|
|
|
} else if ($('.notification')) { |
|
52
|
|
|
$('.notification:not(.is-hidden)').addClass('is-hidden'); |
|
53
|
|
|
if ($('#swTableWhoisInfo:not(.is-hidden)')) { |
|
54
|
|
|
$('#swTableWhoisInfo').addClass('is-hidden'); |
|
55
|
|
|
} |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
}); |
|
59
|
|
|
|
|
60
|
|
|
// Prevent drop redirect |
|
61
|
|
|
$(document).on('drop', function(event) { |
|
62
|
|
|
ipcRenderer.send('app:debug', "Preventing drag and drop redirect"); |
|
63
|
|
|
event.preventDefault(); |
|
64
|
|
|
return false; |
|
65
|
|
|
}); |
|
66
|
|
|
|
|
67
|
|
|
// Prevent drag over redirect |
|
68
|
|
|
$(document).on('dragover', function(event) { |
|
69
|
|
|
event.preventDefault(); |
|
70
|
|
|
return false; |
|
71
|
|
|
}); |
|
72
|
|
|
|
|
73
|
|
|
// Toggle devtools |
|
74
|
|
|
$('#navTabDevtools').click(function() { |
|
75
|
|
|
remote.getCurrentWindow().toggleDevTools(); |
|
76
|
|
|
ipcRenderer.send('app:debug', "#navTabDevtools was clicked"); |
|
77
|
|
|
}); |
|
78
|
|
|
|
|
79
|
|
|
// Toggle between tabs |
|
80
|
|
|
$('section.tabs ul li').click(function() { |
|
81
|
|
|
var tabName = $(this).attr('data-tab'); |
|
82
|
|
|
|
|
83
|
|
|
if (tabName != '#') { |
|
84
|
|
|
$('section.tabs ul li').removeClass('is-active'); |
|
85
|
|
|
$('div.container .tab-content').removeClass('current'); |
|
86
|
|
|
|
|
87
|
|
|
$(this).addClass('is-active'); |
|
88
|
|
|
$("#" + tabName).addClass('current'); |
|
89
|
|
|
} |
|
90
|
|
|
ipcRenderer.send('app:debug', "#section.tabs switched to data tab, {0}".format(tabName)); |
|
91
|
|
|
}); |
|
92
|
|
|
|
|
93
|
|
|
// Delete notifications |
|
94
|
|
|
$('.delete').click(function() { |
|
95
|
|
|
ipcRenderer.send('app:debug', ".delete (notifications) was clicked"); |
|
96
|
|
|
var notificationId = $(this).attr('data-notif'); |
|
97
|
|
|
|
|
98
|
|
|
$('#' + notificationId).addClass('is-hidden'); |
|
99
|
|
|
}); |
|
100
|
|
|
|
|
101
|
|
|
}); |
|
102
|
|
|
|
|
103
|
|
|
// Startup checks |
|
104
|
|
|
function startup() { |
|
105
|
|
|
var { |
|
106
|
|
|
navigation |
|
107
|
|
|
} = appSettings; |
|
108
|
|
|
ipcRenderer.send('app:debug', "'navigation.devtools': {0}".format(navigation.devtools)); |
|
109
|
|
|
if (navigation.devtools === true) { |
|
110
|
|
|
$('#navTabDevtools').removeClass('is-force-hidden'); |
|
111
|
|
|
} |
|
112
|
|
|
ipcRenderer.send('app:debug', "'navigation.extendedcollapsed': {0}".format(navigation.extendedcollapsed)); |
|
113
|
|
|
if (navigation.extendedcollapsed === true) { |
|
114
|
|
|
$('#navButtonExpandedmenu').toggleClass('is-active'); |
|
115
|
|
|
$('.is-specialmenu').toggleClass('is-hidden'); |
|
116
|
|
|
} |
|
117
|
|
|
ipcRenderer.send('app:debug', "'navigation.extendedmenu': {0}".format(navigation.extendedmenu)); |
|
118
|
|
|
if (navigation.extendedmenu === false) { |
|
119
|
|
|
$('#navButtonExpandedmenu').addClass('is-force-hidden'); |
|
120
|
|
|
} |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
|
|
/* |
|
124
|
|
|
// Load different panel parts ////////////////// |
|
125
|
|
|
function loadContents() { |
|
126
|
|
|
$('#include.navbar').load(path.join(__dirname, '../html/navigation/navbar.html')); |
|
127
|
|
|
$('#include.navbar.tabs').load(path.join(__dirname, '../html/navigation/navbar.tabs.html')); |
|
128
|
|
|
} |
|
129
|
|
|
*/ |
|
130
|
|
|
|